import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";
// https://vite.dev/config/
export default defineConfig({
	server: {
	    port: 3000,         // 指定开发服务器端口
	    open: true,         // 是否自动在浏览器中打开
		headers: {
		  "Access-Control-Allow-Origin": "*",
		},
	    proxy: {
	      '/api': {
	        target: 'http://localhost:3000', // API代理目标地址
	        changeOrigin: true,              // 是否改变源地址
	        rewrite: (path) => path.replace(/^\/api/, '')
	      }
	    }
	},
	resolve: {
		alias: {
		  "@": path.resolve(__dirname, "src"),
		},
	},
	plugins: [vue({
		template: {
			compilerOptions: {
			  isCustomElement: (tag) => /^micro-app/.test(tag)
			}
		}
	})],
})
